package com.threeti.mecool.core.domain.model.plan.pojo;

import java.util.HashMap;
import java.util.Map;

public enum TaskAction {
	NONE(0, ""),
	TAKE_PHOTO(1, "拍照"),
	INPUT_TEXT(2, "输入文本"),
	INPUT_NUMBER(3, "输入数值"),
	SELECT_SINGLE(4, "单选框"),
	SELECT_MULTIPLE(5, "多选框"),
	;

	public static final int ID_NONE = 0;
	public static final int ID_TAKE_PHOTO = 1;
	public static final int ID_INPUT_TEXT = 2;
	public static final int ID_INPUT_NUMBER = 3;
	public static final int ID_SELECT_SINGLE = 4;
	public static final int ID_SELECT_MULTIPLE = 5;

	public static final Map<Integer, TaskAction> mapper = new HashMap<Integer, TaskAction>();

	static {
		for (TaskAction action : TaskAction.values()) {
			mapper.put(action.getId(), action);
		}
	}

	public static TaskAction from(Integer id) {
		TaskAction action = mapper.get(id);
		if (action == null) {
			action = NONE;
		}
		return action;
	}

	private int id;
	private String text;

	TaskAction(int id, String text) {
		this.id = id;
		this.text = text;
	}

	public int getId() {
		return id;
	}

	public String getText() {
		return text;
	}
}
